#include "simplification.h"
#include <iostream>

int main()
{
   double EPSILON;
   int n, num = 0;

   std::cin >> n;
   std::vector<point> polyline(n);
   std::vector<bool> outline(n);
   for (int i = 0; i < n; i++)
      std::cin >> polyline[i].x >> polyline[i].y;
   std::cin >> EPSILON;

   douglas_peucker(0, n - 1, EPSILON, polyline, outline);

   outline[0] = true;
   outline[n - 1] = true;
   for (int i = 0; i < n; i++)
      if (outline[i])
         num++;
   std::cout << num << "\n";
   for (int i = 0; i < n; i++)
      if (outline[i])
         std::cout << i + 1 << " ";

   return 0;
}
